package com.zyz.dao;

import com.zyz.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * @author 娃娃鱼
 * @date 2018/3/20 20:18
 */
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {

    User findByName(String name);

    User findByNameAndAge(String name, Integer age);

    @Query("from User u where u.name=:name")
    User findUser(@Param("name") String name);

}
